package com.huike.web.controller.report;

import com.huike.report.domain.vo.IndexBaseInfoVO;
import com.huike.report.domain.vo.IndexVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;

    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        IndexBaseInfoVO baseInfo = reportService.getBaseInfo(beginCreateTime, endCreateTime);
        return AjaxResult.success(baseInfo);
    }


    @GetMapping
    public AjaxResult getTodayInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                               @RequestParam("endCreateTime") String endCreateTime){
        IndexVo infoVO =reportService.getTodayInfo(beginCreateTime, endCreateTime);
        return AjaxResult.success(infoVO);
    }

    /**
     * 首页--商机转化龙虎榜接口
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/businessChangeStatistics")
    public AjaxResult getBusinessChangeStatistics(@RequestParam("beginCreateTime") String beginCreateTime,
                                                  @RequestParam("endCreateTime") String endCreateTime){

        return AjaxResult.success(reportService.getBusinessChangeStatistics(beginCreateTime, endCreateTime));
    }

    /**
     * 线索转化龙虎榜
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/salesStatistic")
    public AjaxResult getSalesStatistic(@RequestParam("beginCreateTime") String beginCreateTime,
                                        @RequestParam("endCreateTime") String endCreateTime){

        return AjaxResult.success(reportService.getSalesStatistic(beginCreateTime, endCreateTime));
    }
}